package com.gwnet.shop.service.impl;

import com.gwnet.shop.domain.UserBuyTenant;
import com.gwnet.shop.mapper.UserBuyTenantMapper;
import com.gwnet.shop.service.IUserBuyTenantService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户收藏店铺Service业务层处理
 * @author 张万鹏
 * @date 2024-08-01
 */
@Service
public class UserBuyTenantServiceImpl implements IUserBuyTenantService
{

    @Resource
    private UserBuyTenantMapper userBuyTenantMapper;


    /**
     * 新增用户购买店铺
     *
     * @param userBuyTenant 用户购买店铺
     * @return 结果
     */
    @Transactional
    @Override
    public int insertUserBuyTenant(UserBuyTenant userBuyTenant){
        UserBuyTenant ubt = userBuyTenantMapper.selectUserBuyTenantByUserIdAndTenantId(userBuyTenant);
        if(ubt == null){
            userBuyTenantMapper.insertUserBuyTenant(userBuyTenant);
        }
        return 0;
    }
}
